<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This file documents the use of the GNU compilers.

Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Warnings and Errors (Using the GNU Compiler Collection (GCC))</title>

<meta name="description" content="Warnings and Errors (Using the GNU Compiler Collection (GCC))">
<meta name="keywords" content="Warnings and Errors (Using the GNU Compiler Collection (GCC))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Indices.html" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Trouble.html" rel="up" title="Trouble">
<link href="Non_002dbugs.html" rel="prev" title="Non-bugs">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
kbd.key {font-style: normal}
span:hover a.copiable-link {visibility: visible}
ul.mark-none {list-style-type: none}
-->
</style>


</head>

<body lang="en_US">
<div class="section-level-extent" id="Warnings-and-Errors">
<div class="nav-panel">
<p>
Previous: <a href="Non_002dbugs.html" accesskey="p" rel="prev">Certain Changes We Don&rsquo;t Want to Make</a>, Up: <a href="Trouble.html" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Warning-Messages-and-Error-Messages"><span>14.9 Warning Messages and Error Messages<a class="copiable-link" href="#Warning-Messages-and-Error-Messages"> &para;</a></span></h3>

<a class="index-entry-id" id="index-error-messages"></a>
<a class="index-entry-id" id="index-warnings-vs-errors"></a>
<a class="index-entry-id" id="index-messages_002c-warning-and-error"></a>
<p>The GNU compiler can produce two kinds of diagnostics: errors and
warnings.  Each kind has a different purpose:
</p>
<ul class="itemize mark-none">
<li><em class="dfn">Errors</em> report problems that make it impossible to compile your
program.  GCC reports errors with the source file name and line
number where the problem is apparent.

</li><li><em class="dfn">Warnings</em> report other unusual conditions in your code that
<em class="emph">may</em> indicate a problem, although compilation can (and does)
proceed.  Warning messages also report the source file name and line
number, but include the text &lsquo;<samp class="samp">warning:</samp>&rsquo; to distinguish them
from error messages.
</li></ul>

<p>Warnings may indicate danger points where you should check to make sure
that your program really does what you intend; or the use of obsolete
features; or the use of nonstandard features of GNU C or C++.  Many
warnings are issued only if you ask for them, with one of the <samp class="option">-W</samp>
options (for instance, <samp class="option">-Wall</samp> requests a variety of useful
warnings).
</p>
<a class="index-entry-id" id="index-pedantic-4"></a>
<a class="index-entry-id" id="index-pedantic_002derrors-3"></a>
<p>GCC always tries to compile your program if possible; it never
gratuitously rejects a program whose meaning is clear merely because
(for instance) it fails to conform to a standard.  In some cases,
however, the C and C++ standards specify that certain extensions are
forbidden, and a diagnostic <em class="emph">must</em> be issued by a conforming
compiler.  The <samp class="option">-pedantic</samp> option tells GCC to issue warnings in
such cases; <samp class="option">-pedantic-errors</samp> says to make them errors instead.
This does not mean that <em class="emph">all</em> non-ISO constructs get warnings
or errors.
</p>
<p>See <a class="xref" href="Warning-Options.html">Options to Request or Suppress Warnings</a>, for
more detail on these and related command-line options.
</p>
</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Non_002dbugs.html">Certain Changes We Don&rsquo;t Want to Make</a>, Up: <a href="Trouble.html">Known Causes of Trouble with GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
